// 拼接HTTPUrl
function url(type, pathname) {
  return window.RPConfig[type] + pathname
}

const bpmpCenterApi = {
  //分页查询所有数据
  getBpmpPage: params => {
    return $http.post(url('itShare', '/lc/bpmp/page'), params)
  },
  //复制表单
  bpmpCopy: params => {
    return $http.post(url('itShare', '/lc/bpmp/copy'), params)
  },
  //修改数据
  bpmpUpdate: params => {
    return $http.post(url('itShare', '/lc/bpmp/update'), params)
  },
  //新增数据
  bpmpInsert: params => {
    return $http.post(url('itShare', '/lc/bpmp/insert'), params)
  },
  //新增并提交炎黄流程
  bpmpSubmit: params => {
    return $http.post(url('itShare', '/lc/bpmp/submit'), params)
  },
  //删除数据
  bpmpDelete: params => {
    return $http.post(url('itShare', '/lc/bpmp/delete'), params)
  },
  //发起填报
  bpmpPulish: params => {
    return $http.post(url('itShare', '/lc/bpmp/publish'), params)
  },
  //暂存数据
  bpmpSaveOrUpdate: params => {
    return $http.post(url('itShare', '/lc/bpmp/saveOrUpdate'), params)
  },
  //通过主键查询单条数据
  bpmpGetById: params => {
    return $http.get(url('itShare', '/lc/bpmp/getById'), params).then(res => res.data)
  },
  //关联表单
  bpmpAssociate: params => {
    return $http.post(url('itShare', '/lc/bpmp/associate'), params)
  },
  // 刷新组织缓存
  bpmpOrgRefresh: params => {
    return $http.post(url('itShare', '/bpmp/org/refresh'), params)
  },
  // 根据单据id获取流程
  getByRecordId: params => {
    return $http.get(url('itShare', '/lc/bpmp/getByRecordId'), params)
  }
}

export default bpmpCenterApi
